/************************************************************************************************************************************
 *File     : light_tex.fx
 *Author   : cpzhang<chengpengzhang@gmail.com>
 *Date     : 2010-4-22
 *Platform : Windows XP, 32-bit, MSVC++ 2005, NVIDIA GeForce 9500 GT, 512M
 *Desc     : Effect file
***********************************************************************************************************************************/

/* global variables */
matrix<float, 4, 4> worldMatrix;
matrix<float, 4, 4> viewMatrix;
matrix<float, 4, 4> projectMatrix;

texture tex;

/* sampler */
sampler s0 = sampler_state
{
	Texture = (tex);
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	MipFilter = LINEAR;
};

/* effect */
technique light_tex
{
	pass p0
	{
		/* render states */
		pixelShader = null;
		vertexShader = null;
		fvf = XYZ | Normal | Tex1;
		Lighting = true;
		NormalizeNormals = true;
		SpecularEnable = false;

		/* transformation */
		WorldTransform[0] = (worldMatrix);
		ViewTransform = (viewMatrix);
		ProjectionTransform = (projectMatrix);

		/* light source */
		LightType[0]         = Directional;
		LightAmbient[0]      = {0.2f,  0.2f, 0.2f, 1.0f};
		LightDiffuse[0]      = {1.0f,  1.0f, 1.0f, 1.0f};
		LightSpecular[0]     = {0.0f,  0.0f, 0.0f, 1.0f};
		LightDirection[0]    = {1.0f, -1.0f, 1.0f, 0.0f};
		LightPosition[0]     = {0.0f,  0.0f, 0.0f, 0.0f};
		LightFalloff[0]      = 0.0f;
		LightRange[0]        = 0.0f;
		LightTheta[0]        = 0.0f;
		LightPhi[0]          = 0.0f;
		LightAttenuation0[0] = 1.0f;
		LightAttenuation1[0] = 0.0f;
		LightAttenuation2[0] = 0.0f;

		/* enable light */
		LightEnable[0] = true;

		/* material */
		MaterialAmbient  = {1.0f, 1.0f, 1.0f, 1.0f};
		MaterialDiffuse  = {1.0f, 1.0f, 1.0f, 1.0f};
		MaterialEmissive = {0.0f, 0.0f, 0.0f, 0.0f};
		MaterialPower    = 1.0f;
		MaterialSpecular = {1.0f, 1.0f, 1.0f, 1.0f};

		/* sampler */
		Sampler[0] = (s0);
	}
}
